import userApi from '@/api/declaration/userApi'
import httpRequest from '@/config/axios/httpRequest'
import {
  QueryUserProfileResp,
  UpdateUserProfileReq,
  UpdateUserProfileResp
} from '@/models/system/UserModel'



// 查询用户个人信息
export const getUserProfile = async () => {
  return await httpRequest.get<QueryUserProfileResp>(userApi.QueryUserProfile)
}

// 修改用户个人信息
export const updateUserProfile = async (data: UpdateUserProfileReq) => {
  return await httpRequest.put<UpdateUserProfileResp>(userApi.UpdateUserProfile, data)
}

// 用户密码重置
export const updateUserPassword = (oldPassword: string, newPassword: string) => {
  return httpRequest.put(userApi.UpdateUserPassword, { oldPassword, newPassword })
}

// 用户头像上传
export const uploadAvatar = (data) => {
  return httpRequest.upload(userApi.UploadAvatar, data)
}
